package main

func sum[T Number](vals ...T) T {
	var ret T
	for _, val := range vals {
		ret = ret + val //必须指定约束，才能相加
	}
	return ret
}

type Number interface {
	int | int8 | int64
}

func Max[T Number](nums ...T) T {
	var ret T = nums[0]
	for i := 1; i < len(nums); i++ {
		if ret < nums[i] {
			ret = nums[i]
		}
	}

	return ret
}
